<?php
    include('incs/database.inc.php');
	include('incs/config.inc.php');
	include('incs/function.inc.php');
	db_open();

    $bulan = $_GET["bulan"];
    $tahun = $_GET["tahun"];

	$query_s = "SELECT *
				FROM `view_l01` WHERE `bulan`=$bulan AND `tahun`=$tahun";
	$hasil = db_query($query_s);
	if(empty($hasil))
		echo db_error();
    while($tampil_data = db_fetch_array($hasil)){
		$arrdata[] = $tampil_data;
	}
?>

<div>
<form method="post" action="./simpan_data.html">

 <?php if(1): ?>
 <table align="center" border="1" width="1024" cellpadding="5" cellspacing="0" style="font-family: Verdana;font-size: 12">
			<tr align="center">
                <th width="30" height="43" rowspan="3">NO.</th>
                <th width="200" rowspan="3" rowspan="3">POLDA / SATPAS</th>
                <th width="320" colspan="8">GOLONGAN SIM</th>
                <th width="40" rowspan="3">JUMLAH</th>
                <th width="240" colspan="6">UJIAN</th>
            </tr>
            <tr>
                <th colspan="3">BARU</th>
                <th colspan="5">PENINGKATAN</th>
                <th colspan="2">TEORI</th>
                <th colspan="2">PRAKTEK I</th>
                <th colspan="2">PRAKTEK II</th>
            </tr>
            <tr>
                <th width="40">A</th>
				<th width="40">C</th>
				<th width="40">D</th>
				<th width="40">AU</th>
				<th width="40">BI</th>
                <th width="40">BIU</th>
                <th width="40">BII</th>
				<th width="40">BIIU</th>
				<th width="40">L</th>
				<th width="40">TL</th>
				<th width="40">L</th>
                <th width="40">TL</th>
				<th width="40">L</th>
                <th width="40">TL</th>
            </tr>
            <?php $seq_number=1;?>
            <?php foreach($arrdata AS $data) { ?>
            <tr>
                <td><?php echo $seq_number;?></td>
                <input name="data[<?php echo $seq_number-1 ?>][id]" type="hidden" value="<?php echo $data['ID_SATPAS'];?>" />
                <td><?php echo $data['NAMA_SATPAS'];?></td>
                <td align="center"><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gba]" id="gba<?=$seq_number-1;?>" type="text" size="4" maxlength="5"  value="<?php echo $data['GOL_BARU_A'];?>" <?php echo $data['GOL_BARU_A'];?>/>
                 </td>
                 <td align="center"><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gbc]" id="gbc<?=$seq_number-1;?>" type="text" size="4" maxlength="5"  value="<?php echo $data['GOL_BARU_C'];?>" <?php echo $data['GOL_BARU_C'];?>/>
                 </td>
                 <td align="center"><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gbd]" id="gbd<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['GOL_BARU_D'];?>" <?php echo $data['GOL_BARU_D'];?>/>
                 </td>
                <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gtau]" id="gtau<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['GOL_TINGKAT_AU'];?>" <?php echo $data['GOL_TINGKAT_AU'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gtbi]" id="gtbi<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['GOL_TINGKAT_BI'];?>" <?php echo $data['GOL_TINGKAT_BI'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gtbiu]" id="gtbiu<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['GOL_TINGKAT_BIU'];?>" <?php echo $data['GOL_TINGKAT_BIU'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gtbii]" id="gtbii<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['GOL_TINGKAT_BII'];?>" <?php echo $data['GOL_TINGKAT_BII'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][gtbiiu]" id="gtbiiu<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['GOL_TINGKAT_BIIU'];?>" <?php echo $data['GOL_TINGKAT_BIIU'];?>/></td>
                <td align="center"><?php echo $jml=$data['GOL_BARU_A']+$data['GOL_BARU_C']+$data['GOL_BARU_D']+$data['GOL_TINGKAT_AU']+$data['GOL_TINGKAT_BI']+$data['GOL_TINGKAT_BIU']+$data['GOL_TINGKAT_BII']+$data['GOL_TINGKAT_BIIU'];?></td>
                <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][utl]" id="utl<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['UJI_TEORI_L'];?>" <?php echo $data['UJI_TEORI_L'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][uttl]" id="uttl<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['UJI_TEORI_TL'];?>" <?php echo $data['UJI_TEORI_L'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][upil]" id="upil<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['UJI_PI_L'];?>" <?php echo $data['UJI_PI_L'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][upitl]" id="upitl<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['UJI_PI_TL'];?>" <?php echo $data['UJI_PI_TL'];?>/></td>
                  <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][upiil]" id="upiil<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['UJI_PII_L'];?>" <?php echo $data['UJI_PII_L'];?>/></td>
                 <td><input style="font-size:10" name="data[<?php echo $seq_number-1 ?>][upiitl]" id="upiitl<?=$seq_number-1;?>" type="text" size="4" maxlength="5" value="<?php echo $data['UJI_PII_TL'];?>" <?php echo $data['UJI_PII_TL'];?>/></td>
            </tr>
            <?php $no++;?>
            <?php } ?>

     </table>

<?php else: ?>
<div align="left">
  <div style="width:500px">
      <div id="p_messages_error">
        Data tidak tersedia. Mungkin disebabkan:
        <br />
        <ol>
        <li>Belum ada peserta pada mata kuliah <?php echo $matkul->NAMA_MK ?> Semester <?php echo $info_semester; ?> <?php echo $info_tahun ?> </li>
		<li>Ada kesalahan teknis, silahkan hubungi bagian terkait </li>
        </ol>
      </div>
   </div>
 </div>
<?php endif; ?>

<br />
<div align="center">
 <?php if(1): ?>
   <button title="Klik untuk menyimpan" name="Submit" type="submit" value="Simpan">Simpan</button>&nbsp;
 <?php endif; ?>
   <button title="Klik untuk kembali" type="button" onclick="self.location='./'"  value="Kembali">&laquo; Kembali</button>
</div>
</form>

</div>
